package day16;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MapDemo {

	public static void main(String[] args) {
		Map<String, String> map = new HashMap<String,String>();
		map.put("01", "zhangsan2");
		map.put("02", "zhangsan2");
		map.put("03", "zhangsan3");
		map.put("04", "zhangsan4");
		map.put("05", null);
		map.put("05", "haha");
		System.out.println("containsKey  "+map.containsKey("02"));
		System.out.println("containsValues  "+map.containsValue("zhangsan3"));
		System.out.println("remove  "+map.remove("002"));
		System.out.println("null  "+map.get("05"));
		
		//Map集合的取出
		Set<String> keySet = map.keySet();
		for (Iterator<String> iterator = keySet.iterator(); iterator.hasNext();) {
			String key = iterator.next();
			String value = map.get(key);
			System.out.println(key + "----->" + value);
		}
	}
	
}
